package com.ruoyi.dict.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dict.domain.DictTeacherInfomationCategory;
import com.ruoyi.dict.service.IDictTeacherInfomationCategoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 教师信息资料类别字典Controller
 * 
 * @author ruoyi
 * @date 2024-07-01
 */
@RestController
@RequestMapping("/dict/teacherInfomationCategory")
public class DictTeacherInfomationCategoryController extends BaseController
{
    @Autowired
    private IDictTeacherInfomationCategoryService dictTeacherInfomationCategoryService;

    /**
     * 查询教师信息资料类别字典列表
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:list')")
    @GetMapping("/list")
    public TableDataInfo list(DictTeacherInfomationCategory dictTeacherInfomationCategory)
    {
        startPage();
        List<DictTeacherInfomationCategory> list = dictTeacherInfomationCategoryService.selectDictTeacherInfomationCategoryList(dictTeacherInfomationCategory);
        return getDataTable(list);
    }

    /**
     * 导出教师信息资料类别字典列表
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:export')")
    @Log(title = "教师信息资料类别字典", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DictTeacherInfomationCategory dictTeacherInfomationCategory)
    {
        List<DictTeacherInfomationCategory> list = dictTeacherInfomationCategoryService.selectDictTeacherInfomationCategoryList(dictTeacherInfomationCategory);
        ExcelUtil<DictTeacherInfomationCategory> util = new ExcelUtil<DictTeacherInfomationCategory>(DictTeacherInfomationCategory.class);
        util.exportExcel(response, list, "教师信息资料类别字典数据");
    }

    /**
     * 获取教师信息资料类别字典详细信息
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(dictTeacherInfomationCategoryService.selectDictTeacherInfomationCategoryById(id));
    }

    /**
     * 新增教师信息资料类别字典
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:add')")
    @Log(title = "教师信息资料类别字典", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DictTeacherInfomationCategory dictTeacherInfomationCategory)
    {
        return toAjax(dictTeacherInfomationCategoryService.insertDictTeacherInfomationCategory(dictTeacherInfomationCategory));
    }

    /**
     * 修改教师信息资料类别字典
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:edit')")
    @Log(title = "教师信息资料类别字典", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DictTeacherInfomationCategory dictTeacherInfomationCategory)
    {
        return toAjax(dictTeacherInfomationCategoryService.updateDictTeacherInfomationCategory(dictTeacherInfomationCategory));
    }

    /**
     * 删除教师信息资料类别字典
     */
    @PreAuthorize("@ss.hasPermi('dict:teacherInfomationCategory:remove')")
    @Log(title = "教师信息资料类别字典", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dictTeacherInfomationCategoryService.deleteDictTeacherInfomationCategoryByIds(ids));
    }
}
